﻿#region - 版 本 注 释 -
/*----------------------------------------------------------------
 * 版权所有 (c) 2024   保留所有权利。
 * CLR版本：4.0.30319.42000
 * 机器名称：DESKTOP-GLJ2Q8J
 * 公司名称：
 * 命名空间：MessageBoxGuoTests
 * 唯一标识：3b617350-31ef-4d14-b07c-78290c7493b3
 * 文件名：MessageBoxGuoTests
 * 当前用户域：DESKTOP-GLJ2Q8J
 * 
 * 创建者：Guo-79991
 * 电子邮箱：799919859@qq.com
 * 创建时间：2025/7/15 11:53:52
 * 版本：V1.0.0
 *
 * 功能描述(Description):
 * 参考文档(Reference):
 * 数据表(Tables):
 * 作者(Author):Guo
 *
 * ----------------------------------------------------------------
 * 修改人：
 * 时间：
 * 修改说明：
 *
 * 版本：V1.0.1
 *----------------------------------------------------------------*/
#endregion - 版 本 注 释 -
using MessageBoxGuo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace MessageBoxGuoTests
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void SuccessButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.Show("操作成功！", AlertType.Success, AlertContainer);
        }

        private void ErrorButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.Show("操作失败，请重试。", AlertType.Error, AlertContainer);
        }

        private void WarningButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.Show("警告：请注意操作权限。", AlertType.Warning, AlertContainer);
        }

        private void InfoButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.Show("提示：系统将于今晚进行维护。", AlertType.Info, AlertContainer);
        }

        private void CustomButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.Show("自定义消息：这是一个自定义样式的提示框。", AlertType.Info, AlertContainer, 5000, Brushes.Purple, Brushes.White);
        }

        private void GlobalSuccessButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.ShowGlobal("全局操作成功！", AlertType.Success);
        }

        private void GlobalErrorButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.ShowGlobal("全局操作失败，请重试。", AlertType.Error);
        }

        private void GlobalWarningButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.ShowGlobal("全局警告：请注意操作权限。", AlertType.Warning);
        }

        private void GlobalInfoButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.ShowGlobal("全局提示：系统将于今晚进行维护。", AlertType.Info);
        }

        private void GlobalCustomButton_Click(object sender, RoutedEventArgs e)
        {
            AlertBox.ShowGlobal("全局自定义消息：这是一个自定义样式的提示框。", AlertType.Info, 5000, Brushes.Purple, Brushes.White);
        }

        private void TestMultipleAlerts_Click(object sender, RoutedEventArgs e)
        {
            // 测试多个弹窗
            for (int i = 1; i <= 5; i++)
            {
                int index = i;
                DispatcherTimer timer = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(index * 500)
                };
                timer.Tick += (s, args) =>
                {
                    timer.Stop();
                    AlertBox.Show($"测试消息 {index}", AlertType.Info, AlertContainer);
                };
                timer.Start();
            }
        }

        private void TestMultipleGlobalAlerts_Click(object sender, RoutedEventArgs e)
        {
            // 测试多个全局弹窗
            for (int i = 1; i <= 5; i++)
            {
                int index = i;
                DispatcherTimer timer = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(index * 500)
                };
                timer.Tick += (s, args) =>
                {
                    timer.Stop();
                    AlertBox.ShowGlobal($"全局测试消息 {index}", AlertType.Info);
                };
                timer.Start();
            }
        }
    }
}
